home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_Update_VBScript.asp < prev    next >
Encoding:
Text File  |  1999-07-21  |  1.6 KB  |  55 lines

  1. <%@ LANGUAGE = VBScript %>
  2. <%  Option Explicit     %>
  3.  
  4. <!--METADATA TYPE="typelib" 
  5. uuid="00000205-0000-0010-8000-00AA006D2EA4" -->
  6. <HTML>
  7.     <HEAD>
  8.         <TITLE>Update Database</TITLE>
  9.     </HEAD>
  10.  
  11.     <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
  12.  
  13.         <!-- Display Header -->
  14.  
  15.         <font size="4" face="Arial, Helvetica">
  16.         <b>Update Database</b></font><br>
  17.       
  18.         <hr size="1" color="#000000">
  19.  
  20.         <%
  21.             Dim oConn        ' object for ADODB.Connection obj
  22.             Dim oRs            ' object for output recordset object
  23.             Dim filePath        ' Directory of authors.mdb file
  24.  
  25.             
  26.             ' Map authors database to physical path
  27.             filePath = Server.MapPath("authors.mdb")
  28.  
  29.             ' Create ADO Connection Component to connect with sample database
  30.  
  31.             Set oConn = Server.CreateObject("ADODB.Connection")
  32.             oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
  33.  
  34.             ' To add, delete and update  recordset, it is recommended to use 
  35.             ' direct SQL statement instead of ADO methods.
  36.             oConn.Execute "Update Authors Set Author ='Scott Clinton'" _
  37.               & "where Author='Scott Guthrie' "
  38.             Set oRs = oConn.Execute ( "select * from Authors where author"  _
  39.               & "= 'Scott Clinton'" )
  40.         %>
  41.         
  42.         Changed Author: <%= oRs("Author") %>, <%= oRs("Yearborn") %> <P>
  43.         
  44.         <%
  45.             oConn.Execute "Update Authors Set Author ='Scott Guthrie'" _
  46.               & "where Author='Scott Clinton' "
  47.             Set oRs = oConn.Execute ( "select * from Authors where author"  _
  48.               & "= 'Scott Guthrie'" )        
  49.        %>
  50.         
  51.        Changed Author: <%= oRs("Author") %>, <%= oRs("Yearborn") %>
  52.  
  53.     </BODY>
  54. </HTML>
  55.